//
//  Matrix.h
//  GSEngine
//
//  Created by Гукун Александр on 1/30/14.
//  Copyright (c) 2014 SNK. All rights reserved.
//

#ifndef __GSEngine__Matrix__
#define __GSEngine__Matrix__

#include <iostream>
#include <math.h>
// matrix working with float
namespace GSEngine
{
    class mat3
    {
    public:
        // data
        union
        {
            struct
            {
                float m11, m12, m13;
                float m21, m22, m23;
                float m31, m32, m33;
            };
            float M[3][3];
            float m[9];
        };
        // methods
        // default constructor
        mat3();
        // constructor with float array
        mat3(float* array);
        // constructor with floats
        mat3(float n11, float n12, float n13,
             float n21, float n22, float n23,
             float n31, float n32, float n33);
        // minor
        float minor(int i, int j);
        // determinant
        float determinant();
        // set matrix identity
        void setIdentity();
        // transpose matrix
        void transpose();
        // inverse matrix
        void inverse();
        // print matrix
        void print();
        // operators
        // operator = mat3
        void operator=(mat3 matrix);
        // operator = float array
        void operator=(float* array);
        // operator * float value
        mat3 operator*(float value);
        // operator * mat3
        mat3 operator*(mat3 matrix);
        // returns pointer to float
        const float* getArrayPtr();
    };
}
#endif /* defined(__GSEngine__Matrix__) */
